package com.example.loginsystem.entity;

import java.util.ArrayList;
import java.util.List;

public class UserDB {
    private static final List<User> users = new ArrayList<>();

    static {
        // 初始化测试用户
        users.add(new User("admin", "123456"));
        users.add(new User("user1", "password1"));
        users.add(new User("test", "test123"));
    }

    public static boolean validate(String username, String password) {
        return users.stream().anyMatch(user ->
                user.getUsername().equals(username) &&
                        user.getPassword().equals(password)
        );
    }
}